import axios from '@/libs/api.request'

//部门
export const getDeptList = () => {
  return axios.request({
    url: '/sys/dept/list1',
    method: 'get'
  })
}

export const getDeptCascader = () => {
  return axios.request({
    url: '/sys/dept/cascader',
    method: 'get'
  })
}

export const updateDept = (data) => {
  return axios.request({
    data: data,
    url: '/sys/dept/update',
    method: 'post',
    headerType: 'json'
  })
}

export const saveDept = data => {
  return axios.request({
    data: data,
    url: "/sys/dept/save",
    method: "post",
    headerType: "json"
  });
};

export const delDept = (data) => {
  return axios.request({
    data: data,
    url: '/sys/dept/delete',
    method: 'post',
    headerType: 'json'
  })
}

//角色
export const getRoleSelect = () => {
  return axios.request({
    url: '/sys/role/select',
    method: 'get'
  })
}

export const getRoleList = (data) => {
  return axios.request({
    params: data,
    url: '/sys/role/list',
    method: 'get'
  })
}

export const getRoleInfo = (data) => {
  return axios.request({
    url: '/sys/role/info/' + data.toString(),
    method: 'get'
  })
}

export const saveRole = (data) => {
  return axios.request({
    data: data,
    url: '/sys/role/save',
    method: 'post',
    headerType: 'json'
  })
}

export const updateRole = (data) => {
  return axios.request({
    data: data,
    url: '/sys/role/update',
    method: 'post',
    headerType: 'json'
  })
}

export const delRole = (data) => {
  return axios.request({
    data: data,
    url: '/sys/role/delete',
    method: 'post',
    headerType: 'json'
  })
}



//用户
export const getUserList = (data) => {
  return axios.request({
    params: data,
    url: '/sys/user/list',
    method: 'get'
  })
}

export const getUserInfo = (data) => {
  return axios.request({
    url: '/sys/user/info/' + data.toString(),
    method: 'get'
  })
}

export const updateUser = (data) => {
  return axios.request({
    data: data,
    url: '/sys/user/update',
    method: 'post',
    headerType: 'json'
  })
}

export const saveUser = (data) => {
  return axios.request({
    data: data,
    url: '/sys/user/save',
    method: 'post',
    headerType: 'json'
  })
}

export const delUser = (data) => {
  return axios.request({
    data: data,
    url: '/sys/user/delete',
    method: 'post',
    headerType: 'json'
  })
}

export const modifyPwd = (data) => {
  return axios.request({
    data: data,
    url: '/sys/user/password',
    method: 'post',
    headerType: 'json'
  })
}

export const resetPwd = (data) => {
  return axios.request({
    data: data,
    url: '/sys/user/resetpwd',
    method: 'post'
  })
}

//菜单
export const getMenuList = (data) => {
  return axios.request({
    params: data,
    url: '/sys/menu/list1',
    method: 'get'
  })
}

export const getMenuNav = () => {
  return axios.request({
    url: '/sys/menu/nav',
    method: 'get'
  })
}

export const getMenuCascader = () => {
  return axios.request({
    url: '/sys/menu/cascader',
    method: 'get'
  })
}

export const saveMenu = (data) => {
  return axios.request({
    data: data,
    url: '/sys/menu/save',
    method: 'post',
    headerType: 'json'
  })
}

export const updateMenu = (data) => {
  return axios.request({
    data: data,
    url: '/sys/menu/update',
    method: 'post',
    headerType: 'json'
  })
}

export const delMenu = (data) => {
  return axios.request({
    data: data,
    url: '/sys/menu/delete',
    method: 'post'
  })
}
//日志
export const getLogList = (data) => {
  return axios.request({
    params: data,
    url: '/sys/log/list',
    method: 'get'
  })
}
